//呼吸灯

const int LedPin = 9;
const int ButPin = A0;

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(9600);
  pinMode(LedPin, OUTPUT);
  pinMode(ButPin, INPUT);
}

void loop()
{
  // put your main code here, to run repeatedly:
  for (int i = 0; i <= 255; i += 5)
  {
    analogWrite(LedPin, i);
    delay(analogRead(ButPin) / 10);
  }
  for (int i = 255; i >= 0; i -= 5)
  {
    analogWrite(LedPin, i);
    delay(analogRead(ButPin) / 10);
  }
}
